function result=constmc2

N = 100;

format long

K=4; t=0; T=1; r=0.05; x0=5;
a=1;b=1;m=1;sigma0=1;


%MCPrice(p,n1,n0,row,column,a,b,m,sigma0,x0,t,T,r,K);
%p=mcprice(w1,w0,a,b,m,sigma0,x0,t,T,r,K);

P0=0;

for ii=1:N
    w0=randn(5000,20000);
    w1=randn(5000,20000);
    p=mcprice(w1,w0,a,b,m,sigma0,x0,t,T,r,K);
    P0=P0+sum(p);
    disp(ii)
end

result = exp(-r*(T-t))*P0/20000/N;
disp(result)
